package ru.amse.baltijsky.javascheme.nodeshape;

import ru.amse.baltijsky.javascheme.util.Size;

import java.awt.*;

/**
 * A strategy of drawing schema tree node shapes according to their types that also provides information necessary for layout
 * (such as the expected size of the node shape). All size assumptions are made basing on the settings in the specified
 * graphics context, ie. node shape drawer is responsible only for shape, not for the style of lines, text font etc.
 */
public interface INodeShape {
    /**
     * Draws the node in the specified graphic context at the specified position.
     *
     * @param x x-coord of the node center
     * @param y y-coord of the node center
     * @param g graphics where to draw the shape
     */
    public void draw(int x, int y, Graphics g);

    /**
     * Returns the size of the bounding rectangle for the shape of the node.
     *
     * @param g the graphics to obtain font metrics
     * @return bounding rectangle size
     */
    public Size getBoundRectSize(Graphics g);

    /**
     * Returns four dimensions of the node shape relative to the shape centre (not necessarily it corresponds
     * with the geometric centre).
     *
     * @param g graphics context to calculate sizes in its current settings
     * @return the shape dimension for the specified direction
     */
    public int[] getShapeDims(Graphics g);
}
